<?php

namespace common\models;

use Yii;

/**
 * This is the model class for table "k_major_catalog".
 *
 * @property string $ZYDM 专业代码
 * @property string $ZYMC 专业名称
 * @property string $MLBB 目录版本
 *
 * @property Major[] $majors
 */
class KMajorCatalog extends \yii\db\ActiveRecord
{
    /**
     * {@inheritdoc}
     */
    public static function tableName()
    {
        return 'k_major_catalog';
    }

    /**
     * {@inheritdoc}
     */
    public function rules()
    {
        return [
            [['ZYDM', 'ZYMC', 'MLBB'], 'required'],
            [['ZYDM'], 'string', 'max' => 20],
            [['ZYMC'], 'string', 'max' => 30],
            [['MLBB'], 'string', 'max' => 10],
            [['ZYDM'], 'unique'],
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels()
    {
        return [
            'ZYDM' => '专业代码',
            'ZYMC' => '专业名称',
            'MLBB' => '目录版本',
        ];
    }

    /**
     * Gets query for [[Majors]].
     *
     * @return \yii\db\ActiveQuery
     */
    public function getMajors()
    {
        return $this->hasMany(Major::className(), ['ZYDM' => 'ZYDM'])->inverseOf('zYDM');
    }
}
